package inet.app.tuvi.base;

import inet.app.tuvi.MyApplication;
import inet.app.tuvi.activity.MainActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.support.v4.app.Fragment;

public class BaseFragment extends Fragment {
	
	protected MainActivity mActivity;

	protected MyApplication mApplication;
	
	protected Resources mResources;
	
	protected static BaseFragment mInstance;
	
	public static BaseFragment newInstance() {
		if (mInstance == null)
			mInstance = new BaseFragment();
		return mInstance;
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		mActivity = (MainActivity) this.getActivity();

		mApplication = (MyApplication) mActivity.getApplication();
		
		mResources = getResources();
	}
	
	public boolean onBackPressed() {
		return false;
	}

	public void onActivityResult(int requestCode, int resultCode, Intent data) {
	}

	protected void setTitle(String title) {
		MainActivity mainActivity = (MainActivity) getActivity();
		mainActivity.setTitle(title);
	}

}
